import Vue from "vue";
import Router from "vue-router";
import home from "@/views/Home/index.vue"; 
import login from "@/views/login.vue"; 
import NOT from "@/views/404.vue"; 

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};
Vue.use(Router);

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: home,
      children: [
        {
          path: '/',
          name: 'homes',
          component: resolve => (require(['@/views/Home/home.vue'], resolve))
        }
      ]
    },
    {
      path: "/login",
      name: "login",
      component: login,
    },
    {
      path: "*",
      name: "404",
      component: NOT,
    },
  ],
});
